package day07;

import java.util.Scanner;

public class CalAirPrice {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //数组
        //switch ()
        //循环     break,
        System.out.println("请输入机票的价格");
        double price = scan.nextDouble();
        System.out.println("请输入乘坐的月份");
        int month = scan.nextInt();
        System.out.println("请输入您选择的仓位：1.头等舱 2.商务舱 3.经济舱");
        int type = scan.nextInt();


        double finaprice = calAirPrice(price, month, type);
        if(finaprice>0){
            System.out.println("最终机票价格为：" + finaprice);
        }
       /* System.out.println("请输入机票的价格");
        double price = scan.nextDouble();
        System.out.println("请输入乘坐的月份");
        int month = scan.nextInt();
        System.out.println("请输入您选择的仓位：1.头等舱 2.商务舱 3.经济舱");
        int type = scan.nextInt();


        double finaprice = calAirPrice(price, month, type);
        if(finaprice>0){
            System.out.println("最终机票价格为：" + finaprice);
        }*/
        /*System.out.println("请输入机票的价格");
        double price = scan.nextDouble();
        System.out.println("请输入乘坐的月份");
        int month = scan.nextInt();
        System.out.println("请输入您选择的仓位：1.头等舱 2.商务舱 3.经济舱");
        int type = scan.nextInt();


        double finaprice = calAirPrice(price, month, type);
        if(finaprice>0){
            System.out.println("最终机票价格为：" + finaprice);
        }*/
    }


    public static double calAirPrice(double price, int month, int type) {


        double finalPrice = 1.0;
        //........
        if (month < 1 || month > 12) {
            System.out.println("月份输入错误");
            return -1;
        }
        if (type < 1 || type > 3) {
            System.out.println("仓位输入错误");
            return -1;
        }

        if (month < 11 && month > 4) {
            switch (type) {
                case 1:
                    finalPrice = price * 0.9;
                    break;
                case 2:
                    finalPrice = price * 0.85;
                    break;
                case 3:
                    finalPrice = price * 0.8;
                    break;
            }
        } else {
            switch (type) {
                case 1:
                    finalPrice = price * 0.7;
                    break;
                case 2:
                    finalPrice = price * 0.65;
                    break;
                case 3:
                    finalPrice = price * 0.6;
                    break;
            }

        }
        return finalPrice;
    }
    /*public static double calAirPrice(double price, int month, int type) {


        double finalPrice = 1.0;
        //........
        if (month < 1 || month > 12) {
            System.out.println("月份输入错误");
            return -1;
        }
        if (type < 1 || type > 3) {
            System.out.println("仓位输入错误");
            return -1;
        }

        if (month < 11 && month > 4) {
            switch (type) {
                case 1:
                    finalPrice = price * 0.9;
                    break;
                case 2:
                    finalPrice = price * 0.85;
                    break;
                case 3:
                    finalPrice = price * 0.8;
                    break;
            }
        } else {
            switch (type) {
                case 1:
                    finalPrice = price * 0.7;
                    break;
                case 2:
                    finalPrice = price * 0.65;
                    break;
                case 3:
                    finalPrice = price * 0.6;
                    break;
            }

        }
        return finalPrice;
    }*/
    /*public static double calAirPrice(double price, int month, int type) {


        double finalPrice = 1.0;
        //........
        if (month < 1 || month > 12) {
            System.out.println("月份输入错误");
            return -1;
        }
        if (type < 1 || type > 3) {
            System.out.println("仓位输入错误");
            return -1;
        }

        if (month < 11 && month > 4) {
            switch (type) {
                case 1:
                    finalPrice = price * 0.9;
                    break;
                case 2:
                    finalPrice = price * 0.85;
                    break;
                case 3:
                    finalPrice = price * 0.8;
                    break;
            }
        } else {
            switch (type) {
                case 1:
                    finalPrice = price * 0.7;
                    break;
                case 2:
                    finalPrice = price * 0.65;
                    break;
                case 3:
                    finalPrice = price * 0.6;
                    break;
            }

        }
        return finalPrice;
    }*/
}
